package com.zjj.jvm.example;

/**
 * @author zhanglei.zjj
 * @description 验证java程序中静态代码块、无参构造、有参构造的执行顺序 以及 类的加载时机
 * @date 2023/3/4 15:50
 */
public class TestProcessOrder {
    static {
        System.out.println("TestProcessOrder--dynamicBlock load ......");
    }

    // 构造代码块
    {
        System.out.println("constructorBlock process ......");
    }

    public static void main(String[] args) {
        User user1 = new TestProcessOrder().new User(18, "zjj");
        User user2 = new TestProcessOrder().new User(19, "zl");
    }

    class User {
        private int age;
        private String name;

        public User(int age, String name) {
            this.age = age;
            this.name = name;

            System.out.println("User--all argConstructor process ......");
        }
    }

    static class A {
        static {
            System.out.println("A--dynamicBlock load......");
        }

        public void testA() {

        }
    }
}
